package itheima.com.mythreadpool;

import java.util.concurrent.ArrayBlockingQueue;
import java.util.concurrent.Executors;
import java.util.concurrent.ThreadPoolExecutor;
import java.util.concurrent.TimeUnit;

public class MyThreadPoolDemo3 {
    public static void main(String[] args) {
        ThreadPoolExecutor pool = new ThreadPoolExecutor(2,3,1, TimeUnit.SECONDS,new ArrayBlockingQueue<>(10), Executors.defaultThreadFactory(),new ThreadPoolExecutor.AbortPolicy());
//      pool.submit(new MyRunnable());
//      pool.submit(new MyRunnable());

        pool.submit(()->{
            System.out.println(Thread.currentThread().getName()+"正在执行");
        });
        pool.submit(()->{
            System.out.println(Thread.currentThread().getName()+"正在执行");
        });

      pool.shutdown();
    }
}
